﻿using Advanced.Domain.Core;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Advanced.Domain.Service
{
    public class ProfileService
        : IProfileService
    {
        private readonly UserManager<ApplicationUser> _userManager;
        private readonly IIdentityServerInteractionService _interactionService;
        public ProfileService(IIdentityServerInteractionService interactionService
            , UserManager<ApplicationUser> userManager)
        {
            _interactionService = interactionService;
            _userManager = userManager;
        }
        public async Task GetProfileDataAsync(ProfileDataRequestContext context)
        {
            if (context.Subject.Claims.Any())
            {
                context.IssuedClaims = context.Subject.Claims.ToList();
            }
        }

        public async Task IsActiveAsync(IsActiveContext context)
        {
            context.IsActive = true;
        }
    }
}
